import request from '../utils/request';

// 发送评论
export function sendComment(data: {
  content: string;
  toPid: number;
}) {
  return request({
    url: '/comment/send',
    method: 'post',
    data
  });
}

// 获取评论列表
export function fetchCommentList(params: {
  pageNum: number;
  pageSize: number;
  toPid: string;
  sortBy?: string;
  orderBy?: string;
}) {
  return request({
    url: '/comment/list',
    method: 'get',
    params
  });
}

// 删除评论
export function deleteComment(id: number) {
  return request({
    url: `/comment/delete/${id}`,
    method: 'delete'
  });
}

// 发送评论回复
export function sendCommentReply(data: {
  content: string;
  toCid: number;
  toName: string;
  toPid: number;
}) {
  return request({
    url: '/comment/reply',
    method: 'post',
    data
  });
}

// 获取评论回复列表
export function fetchCommentReplyList(params: {
  pageNum: number;
  pageSize: number;
  toCid: number;
  sortBy?: string;
  orderBy?: string;
}) {
  return request({
    url: '/comment/reply/list',
    method: 'get',
    params
  });
}

// 删除评论回复
export function deleteCommentReply(id: number) {
  return request({
    url: `/comment/reply/delete/${id}`,
    method: 'delete'
  });
} 